package com.smart.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smart.model.domain.ProjectStatusAxisDO;
import com.smart.model.request.HotWorkRequest;
import com.smart.model.request.ProjectStatusAxisRequest;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * @author zhanghong
 */
@Repository
public interface ProjectStatusAxisMapper extends BaseMapper<ProjectStatusAxisDO> {
    ProjectStatusAxisDO selectDOById(Long id);
    List<ProjectStatusAxisDO> selectDOList(ProjectStatusAxisDO projectStatusAxis);
    int insertDO(ProjectStatusAxisDO projectStatusAxis);
    int batchInsertDO(List<ProjectStatusAxisDO> projectStatusAxisDOList);
    int updateDO(ProjectStatusAxisDO projectStatusAxis);
    int deleteDOById(Long id);
    int deleteDOByIds(String[] ids);

    @Select({"<script>",
            "   select count(1) from project_status_axis",
            "   <where>",
            "       deleted=0",
            "       <if test=\"1==0\">and id=#{param.id}</if>",
            "   </where>",
            "</script>"})
    long pageCount(@Param("param") ProjectStatusAxisRequest param);
    @Select({"<script>",
            "   select * from project_status_axis",
            "   <where>",
            "       deleted=0",
            "       <if test=\"1==0\">and id=#{param.id}</if>",
            "   </where>",
            "   order by create_time desc limit #{limit} offset #{offset}",
            "</script>"})
    List<ProjectStatusAxisDO> pageQuery(@Param("param") ProjectStatusAxisRequest param, @Param("limit") int limit, @Param("offset") long offset);

    List<Long> selectDOByRequest(HotWorkRequest request);
}
